import { ref } from 'vue'
import { defineStore } from 'pinia'
export const useFilePidStore = defineStore(
  'filePid',
  () => {
    const filePid = ref('') //首页定位
    const recoverPid = ref() //回收站定位
    const uploadingPid = ref() //文件上传定位
    //设置所以初始位置
    const setAllPid = (id) => {
      setFilePid(id)
      setRecoverPid(id)
      setUploadingPid(id)
    }
    const setFilePid = (id) => {
      filePid.value = id
    }
    const setRecoverPid = (id) => {
      recoverPid.value = id
    }
    const setUploadingPid = (id) => {
      uploadingPid.value = id
    }
    return {
      filePid,
      recoverPid,
      uploadingPid,
      setFilePid,
      setRecoverPid,
      setUploadingPid,
      setAllPid
    }
  },
  {
    persist: true // 持久化
  }
)
